With the popularity of electronic devices, such as smart phones and tablet computers, various electronic games and websites keep coming up with new products, thus making people increasingly dependent on electronic devices. Usage of smart phones, panel computers, and the like can be found in activities, such as walking, eating, drinking, being in a car, or even resting in bed.
It is harmful to the eyes and bad for eyesight due to prolonged watching of an electronic display and an improper short distance between the eyes and the display screen of the electronic device. For example, myopia and other eye diseases have been commonly found in primary and middle school students. Nowadays, known eye protecting solutions require additional special apparatuses, such as commonly used infrared sensors, ultrasonic sensors, or directly used distance sensors, to acquire data related to eyes. However, these technologies will increase hardware costs and cannot solve the problem of inaccurate measurements. For example, for the distance sensor, if a user's hand is placed above the sensor during operation, the distance that the sensor detects is the distance between the user's hand and the display screen rather than the distance between the user's face and the display screen, thereby causing an incorrect measurement. The present disclosure provides a method that uses a front camera of the electronic device to capture images and processes the captured images to obtain the number of pixels between the user's eyes and a screen or the distance between the user's eyes and a screen of the electronic devices to warn the user of a too close (improper) viewing distance. The method according to the present invention does not require to equip the electronic device with a distance sensor or the like, thereby avoiding incorrect measurements, saving costs, and simplifying the manufacture process of the electronic device.